Repository navigation
feat: per-call arcsec_after_decimal override for arcsecond tick labels - #547
Merged
Merged
Conversation
#546) The arcsecond symbol-over-decimal format (3.″8 rather than 3.8") was switchable only through the global `ticks.symbol_over_decimal` config flag, so a single figure could not opt in without mutating `conf.instance`. `_arcsec_labels` and `apply_extent` now take a `symbol_over_decimal` argument that overrides the config in both directions; `None` (the default) still reads the config, so every existing caller is unchanged. The public plotting functions `plot_array`, `plot_grid` and `plot_inversion_reconstruction` expose it as `arcsec_after_decimal`, bridging the public API name to the internal/config name at that boundary (the shipped config key is untouched). Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019mofs7R3chP12wzoCPjnaw
3 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #546.
Summary
The arcsecond symbol-over-decimal formatting already shipped:
_arcsec_labelsrenders3.″8whenticks.symbol_over_decimalis set invisualize/general.yaml. But the switch was global config only, so a script wanting it for one figure had to mutateconf.instanceand restore it afterwards — the fragile, stateful pattern the originating request was filed to remove.This threads a per-call override down the plotting stack, so
plot_array(..., arcsec_after_decimal=True)works on a single call without touching config.The public name (
arcsec_after_decimal, the one users read) differs from the internal/config name (symbol_over_decimal, already shipped and documented ingeneral.yaml). Renaming the config key would break anyone who has already set it, so the two are bridged at each public function'sapply_extentcall rather than unified.API Changes
Three public plotting functions gain one optional keyword,
arcsec_after_decimal: Optional[bool] = None—plot_array,plot_gridandplot_inversion_reconstruction.Trueforces the symbol-over-decimal form,Falseforces the suffix form, andNone(the default) reads the config flag exactly as before.Purely additive. No signature is reordered, no default changes, and
Noneis byte-for-byte the old behaviour — the config read simply moved into anif symbol_over_decimal is None:fallback. The config keysymbol_over_decimalis unchanged andgeneral.yamlis untouched.See full details below.
Test Plan
test_autoarray/plot→ 35 passed (test_utils.py: 33 = 30 baseline + 3 new)conf.instancenever mutated; explicitFalsebeating a configTrue;Nonestill following config in both statesplot_arrayat all three flag values on a 10×10Array2D, reading the labels back off the axes:arcsec_after_decimal=True→['-1.″9', '0.″0', '1.″9']arcsec_after_decimal=None→['-1.9"', '0.0"', '1.9"']arcsec_after_decimal=False→['-1.9"', '0.0"', '1.9"']test_autoarray→ 1408 passed, 74 skipped, 8 failed — all pre-existing and unrelated, confirmed by re-running them in a detached worktree at the pristine branch point35aa681f, where they fail identically. Cause isModuleNotFoundError: No module named 'numba'in this container; all 8 are w-tilde / sparse-operator tests undertest_autoarray/inversion/, which this diff does not touch.Full API Changes (for automation & release notes)
Added
autoarray.plot.plot_array(..., arcsec_after_decimal: Optional[bool] = None)— per-call override of theticks.symbol_over_decimalconfig flagautoarray.plot.plot_grid(..., arcsec_after_decimal: Optional[bool] = None)— sameautoarray.plot.plot_inversion_reconstruction(..., arcsec_after_decimal: Optional[bool] = None)— sameautoarray.plot.utils.apply_extent(ax, extent, symbol_over_decimal: Optional[bool] = None)— forwards the override to the label formatterautoarray.plot.utils._arcsec_labels(ticks, symbol_over_decimal: Optional[bool] = None)—Nonereads config,True/Falseoverride itRemoved
Migration
conf.instance["visualize"]["general"]["ticks"]["symbol_over_decimal"] = True… then restore itplot_array(array=array, arcsec_after_decimal=True)Generated by the PyAutoLabs agent workflow.
🤖 Generated with Claude Code
https://claude.ai/code/session_019mofs7R3chP12wzoCPjnaw
Generated by Claude Code